package org.testis.data;

import java.io.Serializable;
import java.util.LinkedHashMap;

/**
 *
 * @author nurhat
 */
public class TestStepDataObject implements Serializable, Cloneable {

    private static final long serialVersionUID = 19821L;
    /**
     * Action tpye of current test step
     */
    protected String m_actionType;
    /**
     * Call module in asynch way ore not
     */
    protected boolean m_asynchCall;
    /**
     * Data to be applied to test step
     */
    protected LinkedHashMap<String, String> m_dataToApply;
    /**
     * Module Data to be applied to test step
     */
    private LinkedHashMap<String, String> m_moduleDataToApply;
    /**
     * Unique message id given to test step data object to
     * get pair of result data with sent data.
     */
    protected String m_messageId;
    /**
     * Module type to be used for proccessing this data
     */
    protected String m_moduleType;
    /**
     * Test pc id to run test step over
     */
    protected String m_macAddress;
    /**
     * Related test step id
     */
    protected String m_testStepId;
    /**
     * Test step timeout value.
     */
    protected int m_timeOut;
    /**
     * Stops execution of step
     */
    private boolean m_stopExecution;
    /**
     * Expected result type of test step
     */
    private TestStepResultType m_expectedResultType;
    /**
     * Design Tree id of the Test Step Data Object
     */
    private String m_TestStepDataId;
    /**
     * Design Name of the Test Step Data Object
     */
    private String m_TestStepDataName;
    /**
     * Condition failed or not
     */
    protected boolean m_conditionfailed;
    /**
     * Holds result postfix
     */
    private String m_storeResultPostfix;

    public TestStepDataObject() {
        m_moduleDataToApply = new LinkedHashMap<String, String>();
        m_dataToApply = new LinkedHashMap<String, String>();
    }

    public TestStepDataObject(TestStepDataObject data) {
        if (data != null) {
            setActionType(data.getActionType());
            setAsynchCall(data.isAsynchCall());
            setDataToApply(data.getDataToApply());
            setModuleDataToApply(data.getModuleDataToApply());
            setMessageId(data.getMessageId());
            setModuleType(data.getModuleType());
            setMacAddress(data.getMacAddress());
            setTestStepId(data.getTestStepId());
            setTimeOut(data.getTimeOut());
            setStopExecution(data.isStopExecution());
            setExpectedResultType(data.getExpectedResultType());
            setStoreResultPostfix(data.getStoreResultPostfix());
        }
    }

    public String getActionType() {
        return m_actionType;
    }

    public LinkedHashMap<String, String> getDataToApply() {
        return m_dataToApply;
    }

    public String getMessageId() {
        return m_messageId;
    }

    public String getModuleType() {
        return m_moduleType;
    }

    public String getMacAddress() {
        return m_macAddress;
    }

    public String getTestStepId() {
        return m_testStepId;
    }

    public int getTimeOut() {
        return m_timeOut;
    }

    public String getTestStepDataId() {
        return m_TestStepDataId;
    }

    public String getTestStepDataName() {
        return m_TestStepDataName;
    }

    public boolean isAsynchCall() {
        return m_asynchCall;
    }

    public void setActionType(String m_actionType) {
        this.m_actionType = m_actionType;
    }

    public void setAsynchCall(boolean m_AsynchCall) {
        this.m_asynchCall = m_AsynchCall;
    }

    public void setDataToApply(LinkedHashMap<String, String> m_dataToApply) {
        this.m_dataToApply = m_dataToApply;
    }

    public void setMessageId(String m_messageId) {
        this.m_messageId = m_messageId;
    }

    public void setModuleType(String m_moduleType) {
        this.m_moduleType = m_moduleType;
    }

    public void setMacAddress(String m_pcId) {
        this.m_macAddress = m_pcId;
    }

    public void setTestStepId(String m_testStepId) {
        this.m_testStepId = m_testStepId;
    }

    public void setTimeOut(int m_timeOut) {
        this.m_timeOut = m_timeOut;
    }

    public void setTestStepDataId(String m_TestStepDataId) {
        this.m_TestStepDataId = m_TestStepDataId;
    }

    public void setTestStepDataName(String m_TestStepDataName) {
        this.m_TestStepDataName = m_TestStepDataName;
    }

    public boolean isConditionFailed() {
        return m_conditionfailed;
    }

    public void setConditionFailed(boolean conditionfailed) {
        this.m_conditionfailed = conditionfailed;
    }

    /**
     * Clones current object
     * @return a new instance of TestStepDataObject generated from current object
     * @throws java.lang.CloneNotSupportedException
     */
    @Override
    protected Object clone() {
        try {
            return super.clone();
        } catch (CloneNotSupportedException ex) {
            return new TestStepDataObject();
        }
    }

    public boolean isStopExecution() {
        return m_stopExecution;
    }

    public void setStopExecution(boolean m_stopExecution) {
        this.m_stopExecution = m_stopExecution;
    }

    public TestStepResultType getExpectedResultType() {
        return m_expectedResultType;
    }

    public void setExpectedResultType(TestStepResultType m_expectedResultType) {
        this.m_expectedResultType = m_expectedResultType;
    }

    public LinkedHashMap<String, String> getModuleDataToApply() {
        return m_moduleDataToApply;
    }

    public void setModuleDataToApply(
            LinkedHashMap<String, String> m_moduleDataToApply) {
        this.m_moduleDataToApply = m_moduleDataToApply;
    }

    /**
     * @return the m_storeResultPostfix
     */
    public String getStoreResultPostfix() {
        return m_storeResultPostfix;
    }

    /**
     * @param m_storeResultPostfix the m_storeResultPostfix to set
     */
    public void setStoreResultPostfix(String m_storeResultPostfix) {
        this.m_storeResultPostfix = m_storeResultPostfix;
    }
}
